package com.ideaaedi.springcloud.jd.commonspring.feignclient;


import com.ideaaedi.springcloud.jd.commonds.entity.Result;
import com.ideaaedi.springcloud.jd.commonds.entity.user.bo.ApiInfoBO;
import com.ideaaedi.springcloud.jd.commonds.entity.user.vo.resp.SysDataScopeDetailRespVO;
import com.ideaaedi.springcloud.jd.commonds.entity.user.vo.resp.SysUserDetailRespVO;
import com.ideaaedi.springcloud.jd.commonspring.config.FeignClientConfig;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;

import java.util.LinkedHashSet;

/**
 * 调用user微服务
 *
 * @author <font size = "20" color = "#3CAA3C"><a href="https://gitee.com/JustryDeng">JustryDeng</a></font> <img
 * src="https://gitee.com/JustryDeng/shared-files/raw/master/JustryDeng/avatar.jpg" />
 * @since 2021.0.5.B
 */
@FeignClient(name = "${application.name.user}", configuration = {FeignClientConfig.class})
public interface OauthFeignClient {
    
    /**
     * 查询用户详情
     *
     * @param userId 用户id
     *
     * @return 用户详情
     */
    @GetMapping("/sys-user/detail/{userId}")
    Result<SysUserDetailRespVO> sysUserDetail(@PathVariable("userId") Long userId);
    
    /**
     * 查询用户直接拥有的所有api简讯
     *
     * @param userId 用户id
     *
     * @return 用户直接拥有的所有api简讯
     */
    @GetMapping(value = "/sys-api-resource/list-user-api/{userId}")
    Result<LinkedHashSet<ApiInfoBO>> sysUserListUserApi(@PathVariable("userId") Long userId);
    
    /**
     * 查用户数据权限
     *
     * @param userId 用户id
     *
     * @return 查用户数据权限
     */
    @GetMapping(value = "/sys-data-scope/detail-by-userId/{userId}")
    Result<SysDataScopeDetailRespVO> sysDataScopeDetailByUserId(@PathVariable("userId") Long userId);
}
